/**
 * Created by Skipper on 2017/4/21.
 */
/*****时间格式转换*****/
export function formatDate() {
  let date = new Date();
  let y = date.getFullYear();
  let m = date.getMonth() + 1;
  m = m < 10 ? ('0' + m) : m;
  let d = date.getDate();
  d = d < 10 ? ('0' + d) : d;
  let h = date.getHours();
  let minute = date.getMinutes();
  minute = minute < 10 ? ('0' + minute) : minute;
  let secend = date.getSeconds();
  secend = secend < 10 ? ('0' + secend) : secend;
  let t = y + '/' + m + '/' + d + ' ' + h + ':' + minute + ':' + secend;
  return t;
}
export function formatDateToMinAndSeconds(v) {
  let date = new Date();
  let y = date.getFullYear();
  let m = date.getMonth() + 1;
  m = m < 10 ? ('0' + m) : m;
  let d = date.getDate();
  d = d < 10 ? ('0' + d) : d;
  let h = date.getHours();
  let minute = date.getMinutes();
  minute = minute < 10 ? ('0' + minute) : minute;
  let secend = date.getSeconds();
  secend = secend < 10 ? ('0' + secend) : secend;
  let t = minute + ':' + secend;
  return t;
}
export function formatDateToHourAndSeconds(v) {
  let unixtime = v;
  let date = new Date(unixtime * 1000);
  let y = date.getFullYear();
  let m = date.getMonth() + 1;
  m = m < 10 ? ('0' + m) : m;
  let d = date.getDate();
  d = d < 10 ? ('0' + d) : d;
  let h = date.getHours();
  let minute = date.getMinutes();
  minute = minute < 10 ? ('0' + minute) : minute;
  let secend = date.getSeconds();
  secend = secend < 10 ? ('0' + secend) : secend;
  let t = h + ":" + minute + ':' + secend;
  return t;
}